package com.minimalist.common.entity.lindi.vo.contracttemplatefieldoption;

import cn.hutool.core.date.DatePattern;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.minimalist.common.utils.Add;
import com.minimalist.common.utils.Update;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;

import java.io.Serial;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Objects;

/**
 * 林地指标平台_合同模板字段选项VO
 *
 * @author 11987
 * @since 2025-05-31
 */

@Schema(name = "林地指标平台_合同模板字段选项实体")
public class LindiContractTemplateFieldOptionVO implements Serializable{
    @Serial
    private static final long serialVersionUID = 1L;

    @NotNull(message = "选项ID不能为空", groups = {Update.class})
    @JsonSerialize(using = ToStringSerializer.class)
    @Schema(name = "contractTemplateFieldOptionId", description = "选项ID", type = "string")
    private Long contractTemplateFieldOptionId;

    @NotNull(message = "合同模板配置字段ID不能为空", groups = {Add.class, Update.class})
    @JsonSerialize(using = ToStringSerializer.class)
    @Schema(name = "contractTemplateFieldId", description = "合同模板配置字段ID", type = "string")
    private Long contractTemplateFieldId;

    @NotBlank(message = "选项标签不能为空", groups = {Add.class, Update.class})
    @Schema(name = "optionLabel", description = "选项标签", type = "string")
    private String optionLabel;

    @NotBlank(message = "选项值不能为空", groups = {Add.class, Update.class})
    @Schema(name = "optionValue", description = "选项值", type = "string")
    private String optionValue;

    @Schema(name = "sortOrder", description = "排序序号", type = "integer")
    private Integer sortOrder;

    @JsonSerialize(using = ToStringSerializer.class)
    @Schema(name = "createId", description = "创建人ID", type = "string")
    private Long createId;

    @JsonSerialize(using = ToStringSerializer.class)
    @Schema(name = "updateId", description = "更新人ID", type = "string")
    private Long updateId;

    @Schema(name = "createTime", description = "创建时间", type = "string")
    @JsonFormat(pattern = DatePattern.NORM_DATETIME_PATTERN)
    private LocalDateTime createTime;

    @Schema(name = "updateTime", description = "更新时间", type = "string")
    @JsonFormat(pattern = DatePattern.NORM_DATETIME_PATTERN)
    private LocalDateTime updateTime;

    public LindiContractTemplateFieldOptionVO(){
    }

    public Long getContractTemplateFieldOptionId(){
        return contractTemplateFieldOptionId;
    }

    public void setContractTemplateFieldOptionId(Long contractTemplateFieldOptionId){
        this.contractTemplateFieldOptionId = contractTemplateFieldOptionId;
    }

    public Long getContractTemplateFieldId(){
        return contractTemplateFieldId;
    }

    public void setContractTemplateFieldId(Long contractTemplateFieldId){
        this.contractTemplateFieldId = contractTemplateFieldId;
    }

    public String getOptionLabel(){
        return optionLabel;
    }

    public void setOptionLabel(String optionLabel){
        this.optionLabel = optionLabel;
    }

    public String getOptionValue(){
        return optionValue;
    }

    public void setOptionValue(String optionValue){
        this.optionValue = optionValue;
    }

    public Integer getSortOrder(){
        return sortOrder;
    }

    public void setSortOrder(Integer sortOrder){
        this.sortOrder = sortOrder;
    }

    public Long getCreateId(){
        return createId;
    }

    public void setCreateId(Long createId){
        this.createId = createId;
    }

    public Long getUpdateId(){
        return updateId;
    }

    public void setUpdateId(Long updateId){
        this.updateId = updateId;
    }

    public LocalDateTime getCreateTime(){
        return createTime;
    }

    public void setCreateTime(LocalDateTime createTime){
        this.createTime = createTime;
    }

    public LocalDateTime getUpdateTime(){
        return updateTime;
    }

    public void setUpdateTime(LocalDateTime updateTime){
        this.updateTime = updateTime;
    }

    @Override
    public boolean equals(Object o){
        if (this == o){
            return true;
        }
        if (o == null || getClass() != o.getClass()){
            return false;
        }
        LindiContractTemplateFieldOptionVO that = (LindiContractTemplateFieldOptionVO) o;
        return Objects.equals(contractTemplateFieldOptionId, that.contractTemplateFieldOptionId) && Objects.equals(contractTemplateFieldId, that.contractTemplateFieldId) && Objects.equals(optionLabel, that.optionLabel) && Objects.equals(optionValue, that.optionValue) && Objects.equals(sortOrder, that.sortOrder) && Objects.equals(createId, that.createId) && Objects.equals(updateId, that.updateId) && Objects.equals(createTime, that.createTime) && Objects.equals(updateTime, that.updateTime);
    }

    @Override
    public int hashCode(){
        return Objects.hash(contractTemplateFieldOptionId, contractTemplateFieldId, optionLabel, optionValue, sortOrder, createId, updateId, createTime, updateTime);
    }
}
